package baseTest;

public class isPalindrome {
    public static void main(String[] args) {
        int x = -122;
        System.out.println(process(x));
    }
    public static boolean process(int x){
        char[] chs = adjust(x);
        boolean flag = true;
        for (int i = 0; i < chs.length/2; i++) {
            if (chs[i] != chs[chs.length-1-i]){
                flag = false;
            }
        }
        return flag;
    }
    public static char[] adjust(int x){
        String str = x+"";
        char[] ch = new char[str.length()*2+1];
        int cur = 0;
        for (int i = 0; i < ch.length; i++) {
            if ((i & 1) == 1){
                ch[i] = str.charAt(cur++);
            } else {
                ch[i] = '#';
            }
        }
        return ch;
    }
}
